<?php
App::uses('AppModel', 'Model');
/**
 * Societe Model
 *
 * @property devis $devis
 * @property questionnaire $questionnaire
 * @property site $site
 */
class Societe extends AppModel {
/**
 * Primary key field
 *
 * @var string
 */
	public $primaryKey = 'id_societe';
/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'raison_sociale';
/**
 * Validation rules
 *
 * @var array
 */
	public $validate = array(
		'id_societe' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'raison_sociale' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Vous devez renseigner la raison sociale',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'adresse_facturation' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Vous devez renseigner l\'adresse de facturation',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'code_postal_societe' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				'message' => 'Vous devez renseigner un code postal valide',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Vous devez renseigner le code postal',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'ville_societe' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Vous devez renseigner la ville',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'nombre_de_site' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Vous devez renseigner le nombre de sites',
			),
			'numeric' => array(
				'rule' => array('numeric'),
			),
		),
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * hasMany associations
 *
 * @var array
 */
	public $hasMany = array(
		'devis' => array(
			'className' => 'devis',
			'foreignKey' => 'id_societe',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'questionnaire' => array(
			'className' => 'questionnaire',
			'foreignKey' => 'id_societe',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'site' => array(
			'className' => 'site',
			'foreignKey' => 'id_societe',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);

}
